//
//  UIAlertController+LBExtend.m
//  PandaTakeaway
//
//  Created by smufs on 2017/6/29.
//  Copyright © 2017年 李冰. All rights reserved.
//

#import "UIAlertController+LBExtend.h"

@implementation UIAlertController (LBExtend)

+(void)showWithMessage:(NSString *)message controller:(UIViewController *)controller sureAction:(void (^)())sureAction{

    UIAlertController *alert = [UIAlertController alertControllerWithTitle:nil message:message preferredStyle:UIAlertControllerStyleAlert];
    
    UIAlertAction *sure = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        
        if (sureAction) sureAction();
    }];
    
    UIAlertAction *cancel = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {

        [alert dismissViewControllerAnimated:YES completion:nil];
    }];
    
    [alert addAction:sure];
    [alert addAction:cancel];
    [controller presentViewController:alert animated:YES completion:nil];
}

@end
